package top.itlir.edc.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import top.itlir.edc.dao.MenuRepository;
import top.itlir.edc.domain.Menu;
import top.itlir.edc.service.IMenuService;


@Service
@Transactional
public class MenuServiceImpl implements IMenuService {

	@Resource
	private MenuRepository menuRepository;

	@Override
	public Page<Menu> pageQuery(Specification<Menu> spec, Pageable pageable) {
		return menuRepository.findAll(spec, pageable);
	}

	@Override
	public List<Menu> findParentMenuIsNull() {
		return menuRepository.findByParentMenuIsNull();
	}

	@Override
	public void save(Menu model) {
		menuRepository.save(model);
	}

}
